package com.wsl.service;

import com.wsl.entity.Address;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * @Author:WangShuliang
 * @Description:
 * @Date:Created in 11:06 2017/10/29
 * @Modified by:
 */
@Service
public class DemoService {
    @Cacheable(value = "usercache",key="#id+'_'+#firstName+'_'+#lastName")
    public String findUser(Long id,String firstName,String lastName){
        System.out.println("无缓存的时候调用这里");
        return "wupengqian";
    }
    @Cacheable(value = "addresscache",key = "#id+'_'+#province+'_'+#city")
    public Address findAddress(Long id,String province,String city){
        System.out.print("无缓存的时候调用这里");
        return new Address(id,province,city);
    }
}